import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/views/login'
import User from '@/components/LayoutUser.vue'
import Admin from '@/components/LayoutAdmin.vue'
import Home from '@/views/home'
import Show from '@/views/show'
import Edit from '@/views/edit'
import Statis from '@/views/statis'


Vue.use(Router)

const routes = [
    {
        path:'/login',
        name:'login',
        component:Login,
    },
    {
        path: '/',

        name: 'user',

        component: User,
        
        redirect:'/home',
        children:[
            {
                path:'/home',
                component:Home,
                mata:{title:'首页'}
            },
            {
                path: '/show',
                component: Show,
                meta: { title: '学生管理' },
            },
            {
                path: '/login',
                component: Login,
                meta: { title: 'login' },
            },
            {
                path: '/statis',
                component: Statis,
                meta: { title: '信息统计' },
            }
        ]
    },
    {
        path:'/admin',
        name:'admin',
        component:Admin,
        redirect:'/admin/home',
        children:[
            {
                path:'home',
                component:Home,
                mata:{title:'首页'}
            },
            {
                path: 'edit',
                component: Edit,
                meta: { title: '信息录入' },
            },
            {
                path: 'home',
                component: Edit,
                meta: { title: '去前台' },
            }
        ]
    }
]

const router = new Router({
    linkActiveClass : "active",
    mode: "history",
    routes
})

export default router;